package day07;

public class PrimeNumber {
    public static void main(String[] args) {
        int i = 0;
        for (int num = 2; num <= 100; num++) {
            boolean flag = true;
            for (int j = 2; j <= num / 2; j++) {
                if (num % j == 0) {
                    flag = false;
                    break;
                }
            }
            if (flag) {
                System.out.print(num + "\t");
                i++;
            }
        }
        System.out.println();
        System.out.println("共有" + i + "个");







        /*        int num = 0 ;
        for (int i = 2; i <101 ; i++) {
            boolean flag = true;
            for (int j = 2; j <=i/2 ; j++) {
                if(i%j==0){
                    flag = false;
                    break;
                }
            }
            if(flag){
                System.out.print(i+"\t");
                num++;
            }
        }
        System.out.println();
        System.out.println("2到100内的素数共有"+num+"个");*/
    }
}
